<template>
  <div>
    <h2>默认展示</h2>
    <h1>{{name}}</h1>
    <h2>示例一：定义一个局部过滤器</h2>
    <div>{{ name | capitalize }}</div>

    <h2>示例二：定义一个全局过滤器</h2>
    <div>{{ name | capitalizeFull }}</div>

    <h2>示例三：过滤器串联</h2>
    <div>{{ name | capitalize | trim}}</div>

  </div>

</template>


<script>
export default {
  data () {
    return {

      name: 'aitesting    '

    }
  },

  filters: {
    capitalize: function (value) {
      if (!value) return ''
      value = value.toString()
      return value.charAt(0).toUpperCase() + value.slice(1)
    },

    trim (value) {
      return 123


    }
  }

}
</script>


<style scoped>
</style>